<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('Construction/index')}">项目管理</a></li>
        <li><a href="{:url('Construction/add')}">发起项目</a></li>
        <li class="active"><a href="{:url('Construction/schedule',array('id'=>$id))}">工程进度</a></li>
    </ul>
    <form class="form-horizontal js-ajax-form" action="{:url('Construction/schedule_post')}" method="post"
          enctype="multipart/form-data">
        <fieldset>
            <input type="hidden" name="project_id" value="{$id}">
            <div class="control-group">
                <label class="control-label">项目名称</label>
                <div class="controls">
                    <input type="text" class="form-control" name="pro_name" value="{$pro_name}" disabled/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">创建时间</label>
                <div class="controls">
                    <input type="text" class="form-control" name="creat_time" value="{$creat_time|date='Y-m-d'}" disabled/>
                </div>
            </div>
            <div class="control-group normal">
                <label class="control-label">进度内容</label>
                <div class="controls">
                    <textarea class="form-control" name="progress_content" required="required"></textarea>
                    <span class="form-required">*</span>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">负责部门/人</label>
                <div class="controls">
                    <input type="text" class="form-control" name="construction_peo" value="{$construction_peo}" disabled/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">计划开工时间</label>
                <div class="controls">
                    <input type="text" class="form-control js-date" name="plan_time"
                           value="{$plan_time|date='Y-m-d'|}" disabled/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">计划竣工时间</label>
                <div class="controls">
                    <input type="text" class="form-control js-date" name="completion_time" id="completion_time"
                           value="{$completion_time|date='Y-m-d'|}" disabled/>
                    <input type="hidden" id="nowDate">
                </div>
            </div>
        </fieldset>
        <div class="form-actions">
            <button type="submit" class="btn btn-primary js-ajax-submit" id="submit">{:lang('ADD')}</button>
            <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
        </div>
    </form>
    <div style="width: 515px;margin: 0 0 10px 0px; padding: 10px 0 0px 20px;">
        <span style="padding: 8px 5px; border-bottom: 4px solid #0b7ebf; font-size: 2.3rem;  color: #0b7ebf; font-weight: bold;">历史进度</span>
    </div>
    <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;">

        <table class="table table-hover table-bordered" style="margin:0 auto; width:96%;">
            <thead>
            <tr>
                <th width="15%">计划开工时间</th>
                <th width="15%">计划竣工时间</th>
                <th width="25%">进度内容</th>
                <th width="15%">负责部门/人</th>
                <th width="15%">创建时间</th>
            </tr>
            </thead>
            <tbody>
            <!--
                ie6,7,8不兼容addEventListener所以使用
                div.onclick = function(event) {
                    //兼容性处理
                    event = event || window.event;
                    console.log(event);
                }
                div.addEventListener('click', function(event) {
                    console.log(event);
                });
            -->
            <foreach name="results" item="vo">
                <tr>
                    <td>
                        <php>echo date('Y-m-d', $vo['plan_time'])</php>
                    </td>
                    <td>
                        <php>echo date('Y-m-d', $vo['completion_time'])</php>
                    </td>
                    <td>{$vo.progress_content}</td>
                    <td>{$vo.construction_peo}</td>
                    <td>
                        <php>echo date('Y-m-d H:m', $vo['add_time'])</php>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
    </div>
</div>

<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>

<script type="text/javascript">
    var t = new Date();
    var year = t.getFullYear();
    var month = t.getMonth() + 1;
    var day = t.getDate();
    if (month < 10) {
        month = "0" + month;
    }
    if (day < 10) {
        day = "0" + day;
    }
    //当前时间
    $("#nowDate").val(year + "-" + month + "-" + day);
    var now_time = $("#nowDate").val();

    //计划竣工时间
    var completion_time = $("#completion_time").val();

    if (now_time === completion_time) {
        $("#submit").hide();
    }

    console.log(now_time);
    console.log(completion_time);

</script>
</body>
</html>